﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;

namespace BlogDemo.Infrastructure.Models
{
    public abstract class QueryParameters
        : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChange(string name)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
        }
        private const int DefaultPageSize = 10;
        private const int DefaultMaxPageSize = 100;
        private int _pageIndex = 1;

        public int PageIndex
        {
            get { return _pageIndex; }
            set
            {
                _pageIndex = value;
            }
        }
        private int _pageSize = DefaultPageSize;

        public int PageSize
        {
            get { return _pageSize; }
            set
            {
                _pageSize = value;
                RaisePropertyChange(nameof(PageSize));
            }
        }
        private int _magPageSize = DefaultMaxPageSize;

        public int MaxPageSize
        {
            get { return _magPageSize; }
            set
            {
                _magPageSize = value;
                RaisePropertyChange(nameof(MaxPageSize));
            }
        }
        private string _orderBy="Id";

        public string OrderBy
        {
            get { return _orderBy; }
            set
            {
                _orderBy = value;
                RaisePropertyChange(nameof(OrderBy));
            }
        }
        private string fields;

        public string Fields
        {
            get { return fields; }
            set { fields = value; }
        }


    }
}
